///*
// * Copyright 2008-2009 the original author or authors.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// *      http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package net.hasor.cobble.bytebuf;
//import java.nio.ReadOnlyBufferException;
//
///**
// * 如果底层 byteBuf 被释放，那么产生的 ReadOnly 对象也会释放。
// */
//class ReadOnlyByteBuf extends AbstractByteBuf {
//    protected ByteBuf byteBuf;
//
//    ReadOnlyByteBuf(AbstractByteBuf byteBuf) {
//        super(byteBuf.getMaxCapacity());
//        this.markedReaderIndex = byteBuf.markedReaderIndex;
//        this.markedWriterIndex = byteBuf.markedWriterIndex;
//        this.readerIndex = byteBuf.readerIndex;
//        this.writerIndex = byteBuf.writerIndex;
//        this.byteBuf = byteBuf;
//    }
//
//    @Override
//    protected void _putByte(int offset, byte b) {
//        throw new ReadOnlyBufferException();
//    }
//
//    @Override
//    protected void _putBytes(int offset, byte[] b, int off, int len) {
//        throw new ReadOnlyBufferException();
//    }
//
//    @Override
//    protected void extendByteBuf(int targetCapacity) {
//        throw new ReadOnlyBufferException();
//    }
//
//    @Override
//    public ByteBuf copy() {
//        throw new ReadOnlyBufferException();
//    }
//
//    @Override
//    public int capacity() {
//        return this.byteBuf.capacity();
//    }
//
//    @Override
//    public byte[] array() {
//        return this.byteBuf.array();
//    }
//
//    @Override
//    public boolean isDirect() {
//        return this.byteBuf.isDirect();
//    }
//
//    @Override
//    protected byte _getByte(int offset) {
//        return this.byteBuf.getByte(offset);
//    }
//
//    @Override
//    protected int _getBytes(int offset, byte[] b, int off, int len) {
//        return this.byteBuf.getBytes(offset, b, off, len);
//    }
//}
